cmake_minimum_required(VERSION 3.5)

project(example2 LANGUAGES CXX)

add_library(message-objs
  OBJECT 
  message.cpp
)

target_include_directories(
  message-objs
  PUBLIC 
  ${PROJECT_SOURCE_DIR}/include
)

add_library(message-shader
  SHARED
  $<TARGET_OBJECTS:message-objs>
)

add_library(message-static
  STATIC
  $<TARGET_OBJECTS:message-objs>
)


add_executable(helloCmake main.cpp)

target_include_directories(
  helloCmake
  PUBLIC 
  ${PROJECT_SOURCE_DIR}/include
)

target_link_libraries(helloCmake message-shader)


###############
#install
###############
  message(STATUS "Install Prefix: ${CMAKE_INSTALL_PREFIX}")

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
  message(STATUS "Default Install Prefix: ${CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT}")
  message(STATUS "Set Default Install Prefix path to ${CMAKE_BINARY_DIR}/install")
  set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE STRING "The path to use for make install" FORCE)
endif()

set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE STRING "The path to use for make install" FORCE)
message(STATUS "Install Prefix: ${CMAKE_INSTALL_PREFIX}")

install(TARGETS helloCmake DESTINATION bin)

install(TARGETS message-shader DESTINATION bin)

install(TARGETS message-shader DESTINATION lib)
install(TARGETS message-static DESTINATION lib)

install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include)

install(FILES install.conf DESTINATION conf)

